<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Worker | Web 工具库模板</title>
    <meta name="description" content="A VitePress Site">
    <meta name="generator" content="VitePress v1.0.1">
    <link rel="preload stylesheet" href="/web-utils-template/assets/style.CLVUdl9b.css" as="style">
    
    <script type="module" src="/web-utils-template/assets/app.DgcQCNj_.js"></script>
    <link rel="preload" href="/web-utils-template/assets/inter-roman-latin.Bu8hRsVA.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/web-utils-template/assets/chunks/framework.DOaO8ovg.js">
    <link rel="modulepreload" href="/web-utils-template/assets/chunks/theme.DJ0nZxEt.js">
    <link rel="modulepreload" href="/web-utils-template/assets/chunks/el-button.l0sNRNKZ.js">
    <link rel="modulepreload" href="/web-utils-template/assets/pages_worker_index.md.CiPTKjbc.lean.js">
    <link rel="icon" type="image/svg+xml" href="/web-utils-template/vue.svg">
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-e808aada><!--[--><!--]--><!--[--><span tabindex="-1" data-v-6718eb1c></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-6718eb1c> Skip to content </a><!--]--><!----><header class="VPNav" data-v-e808aada data-v-929c1069><div class="VPNavBar has-sidebar top" data-v-929c1069 data-v-2031f861><div class="wrapper" data-v-2031f861><div class="container" data-v-2031f861><div class="title" data-v-2031f861><div class="VPNavBarTitle has-sidebar" data-v-2031f861 data-v-813f4990><a class="title" href="/web-utils-template/" data-v-813f4990><!--[--><!--]--><!----><span data-v-813f4990>Web 工具库模板</span><!--[--><!--]--></a></div></div><div class="content" data-v-2031f861><div class="content-body" data-v-2031f861><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2031f861><!--[--><!----><div id="local-search"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><span class="vp-icon DocSearch-Search-Icon"></span><span class="DocSearch-Button-Placeholder">查找</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2031f861 data-v-7c39e9c9><span id="main-nav-aria-label" class="visually-hidden" data-v-7c39e9c9>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/web-utils-template/" tabindex="0" data-v-7c39e9c9 data-v-b9200a99><!--[--><span data-v-b9200a99>首页</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/web-utils-template/guide/installation.html" tabindex="0" data-v-7c39e9c9 data-v-b9200a99><!--[--><span data-v-b9200a99>工具</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-2031f861 data-v-4e095a04><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-4e095a04 data-v-55ed6563 data-v-2a1906d1><span class="check" data-v-2a1906d1><span class="icon" data-v-2a1906d1><!--[--><span class="vpi-sun sun" data-v-55ed6563></span><span class="vpi-moon moon" data-v-55ed6563></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-2031f861 data-v-85b7e809 data-v-cf93fccb><!--[--><a class="VPSocialLink no-icon" href="https://gitee.com/jh_shot/web-utils-template" aria-label="github" target="_blank" rel="noopener" data-v-cf93fccb data-v-1308c580><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-2031f861 data-v-3a72cf56 data-v-edd2544d><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-edd2544d><span class="vpi-more-horizontal icon" data-v-edd2544d></span></button><div class="menu" data-v-edd2544d><div class="VPMenu" data-v-edd2544d data-v-d73b0329><!----><!--[--><!--[--><!----><div class="group" data-v-3a72cf56><div class="item appearance" data-v-3a72cf56><p class="label" data-v-3a72cf56>Appearance</p><div class="appearance-action" data-v-3a72cf56><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-3a72cf56 data-v-55ed6563 data-v-2a1906d1><span class="check" data-v-2a1906d1><span class="icon" data-v-2a1906d1><!--[--><span class="vpi-sun sun" data-v-55ed6563></span><span class="vpi-moon moon" data-v-55ed6563></span><!--]--></span></span></button></div></div></div><div class="group" data-v-3a72cf56><div class="item social-links" data-v-3a72cf56><div class="VPSocialLinks social-links-list" data-v-3a72cf56 data-v-cf93fccb><!--[--><a class="VPSocialLink no-icon" href="https://gitee.com/jh_shot/web-utils-template" aria-label="github" target="_blank" rel="noopener" data-v-cf93fccb data-v-1308c580><span class="vpi-social-github" /></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-2031f861 data-v-c921bcfc><span class="container" data-v-c921bcfc><span class="top" data-v-c921bcfc></span><span class="middle" data-v-c921bcfc></span><span class="bottom" data-v-c921bcfc></span></span></button></div></div></div></div><div class="divider" data-v-2031f861><div class="divider-line" data-v-2031f861></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-e808aada data-v-2ed5cb68><div class="container" data-v-2ed5cb68><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-2ed5cb68><span class="vpi-align-left menu-icon" data-v-2ed5cb68></span><span class="menu-text" data-v-2ed5cb68>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-2ed5cb68 data-v-64c634d3><button data-v-64c634d3>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-e808aada data-v-5a3f9dcf><div class="curtain" data-v-5a3f9dcf></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-5a3f9dcf><span class="visually-hidden" id="sidebar-aria-label" data-v-5a3f9dcf> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-5a3f9dcf><section class="VPSidebarItem level-0" data-v-5a3f9dcf data-v-8c2536bf><div class="item" role="button" tabindex="0" data-v-8c2536bf><div class="indicator" data-v-8c2536bf></div><h2 class="text" data-v-8c2536bf>基础</h2><!----></div><div class="items" data-v-8c2536bf><!--[--><div class="VPSidebarItem level-1 is-link" data-v-8c2536bf data-v-8c2536bf><div class="item" data-v-8c2536bf><div class="indicator" data-v-8c2536bf></div><a class="VPLink link link" href="/web-utils-template/guide/installation.html" data-v-8c2536bf><!--[--><p class="text" data-v-8c2536bf>安装</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-5a3f9dcf><section class="VPSidebarItem level-0 has-active" data-v-5a3f9dcf data-v-8c2536bf><div class="item" role="button" tabindex="0" data-v-8c2536bf><div class="indicator" data-v-8c2536bf></div><h2 class="text" data-v-8c2536bf>工具</h2><!----></div><div class="items" data-v-8c2536bf><!--[--><div class="VPSidebarItem level-1 is-link" data-v-8c2536bf data-v-8c2536bf><div class="item" data-v-8c2536bf><div class="indicator" data-v-8c2536bf></div><a class="VPLink link link" href="/web-utils-template/pages/pdf/" data-v-8c2536bf><!--[--><p class="text" data-v-8c2536bf>PDF导出（A4）</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-8c2536bf data-v-8c2536bf><div class="item" data-v-8c2536bf><div class="indicator" data-v-8c2536bf></div><a class="VPLink link link" href="/web-utils-template/pages/worker/" data-v-8c2536bf><!--[--><p class="text" data-v-8c2536bf>Worker</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-e808aada data-v-3310fdcb><div class="VPDoc has-sidebar has-aside" data-v-3310fdcb data-v-38b48462><!--[--><!--]--><div class="container" data-v-38b48462><div class="aside" data-v-38b48462><div class="aside-curtain" data-v-38b48462></div><div class="aside-container" data-v-38b48462><div class="aside-content" data-v-38b48462><div class="VPDocAside" data-v-38b48462 data-v-db750571><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-db750571 data-v-fa9e32c0><div class="content" data-v-fa9e32c0><div class="outline-marker" data-v-fa9e32c0></div><div class="outline-title" role="heading" aria-level="2" data-v-fa9e32c0>当前页</div><nav aria-labelledby="doc-outline-aria-label" data-v-fa9e32c0><span class="visually-hidden" id="doc-outline-aria-label" data-v-fa9e32c0> Table of Contents for current page </span><ul class="VPDocOutlineItem root" data-v-fa9e32c0 data-v-6293de89><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-db750571></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-38b48462><div class="content-container" data-v-38b48462><!--[--><!--]--><main class="main" data-v-38b48462><div style="position:relative;" class="vp-doc _web-utils-template_pages_worker_" data-v-38b48462><div><h1 id="worker" tabindex="-1">Worker <a class="header-anchor" href="#worker" aria-label="Permalink to &quot;Worker&quot;">​</a></h1><h2 id="安装依赖" tabindex="-1">安装依赖 <a class="header-anchor" href="#安装依赖" aria-label="Permalink to &quot;安装依赖&quot;">​</a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes material-theme-lighter material-theme-darker vp-code"><code><span class="line"><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;">npm</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;"> i</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;"> workerpool</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;"> -D</span></span></code></pre></div><h2 id="使用示例" tabindex="-1">使用示例 <a class="header-anchor" href="#使用示例" aria-label="Permalink to &quot;使用示例&quot;">​</a></h2><h3 id="基础用法" tabindex="-1">基础用法 <a class="header-anchor" href="#基础用法" aria-label="Permalink to &quot;基础用法&quot;">​</a></h3><p>使用 <code>AppWorker</code> 的静态属性 <code>pool</code> 执行一些简单的方法。</p><!--[--><!----><div class="el-card is-hover-shadow"><!--v-if--><div class="el-card__body" style=""><!--[--><!--[--><div><form class="el-form el-form--default el-form--label-right"><!--[--><div class="el-form-item asterisk-left" role="group" aria-labelledby="el-id-6138-0"><!--[--><!--[--><div id="el-id-6138-0" class="el-form-item__label" style="width:40px;"><!--[-->输入<!--]--></div><!--]--><!--]--><div class="el-form-item__content" style=""><!--[--><div class="el-input-number"><span role="button" aria-label="decrease number" class="el-input-number__decrease"><i class="el-icon" style=""><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"></path></svg><!--]--></i></span><span role="button" aria-label="increase number" class="el-input-number__increase"><i class="el-icon" style=""><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"></path></svg><!--]--></i></span><div class="el-input" style=""><!-- input --><!--[--><!-- prepend slot --><!--v-if--><div class="el-input__wrapper"><!-- prefix slot --><!--v-if--><input class="el-input__inner" step="1" max="Infinity" min="-Infinity" type="number" autocomplete="off" tabindex="0" style=""><!-- suffix slot --><!--v-if--></div><!-- append slot --><!--v-if--><!--]--></div></div><!--]--><!--[--><!--]--></div></div><div class="el-form-item asterisk-left" role="group" aria-labelledby="el-id-6138-1"><!--[--><!--[--><div id="el-id-6138-1" class="el-form-item__label" style="width:40px;"><!--[-->结果<!--]--></div><!--]--><!--]--><div class="el-form-item__content" style=""><!--[--><span class="el-text" style=""><!--[--><!--]--></span><!--]--><!--[--><!--]--></div></div><div class="el-form-item asterisk-left"><!--[--><!--[--><!--v-if--><!--]--><!--]--><div class="el-form-item__content" style="margin-left:40px;"><!--[--><button ariadisabled="false" type="button" class="el-button el-button--primary" style=""><!--v-if--><span class=""><!--[--> 计算斐波那契 <!--]--></span></button><!--]--><!--[--><!--]--></div></div><!--]--></form></div><!--]--><!--]--></div><!--v-if--></div><!--]--><details class="details custom-block"><summary>点击查看</summary><div class="language-vue vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vue</span><pre class="shiki shiki-themes material-theme-lighter material-theme-darker vp-code"><code><span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">template</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">div</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">    &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> labelWidth</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">40px</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> label</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">输入</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-input-number</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> v-model</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">inputValue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-input-number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> label</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">结果</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-text</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;{{</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> result </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}}&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-text</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-button</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> type</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">primary</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> :</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> @</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">click</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">handleCalc</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">          计算斐波那契</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-button</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">    &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">div</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">template</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">script</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> lang</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">ts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> setup</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> AppWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">@lib/worker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> ElMessage</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">element-plus</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> ref</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">vue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> loading </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;">false</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> inputValue </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;">38</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> result </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;&#39;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">function</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">):</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">  if</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &lt;</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 0</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">throw</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> new</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> Error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">输入的数字不能小于0</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">  if</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ==</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ||</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ==</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 2</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">{</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    return</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> else</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    return</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> -</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">+</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> -</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 2</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">async</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> function</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> handleCalc</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">()</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">  try</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;"> true</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">    const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> res</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> await</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> AppWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">exec</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">fibonacci</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> [</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">inputValue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">])</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    result</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> res</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> catch</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">error</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> any</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">)</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    console</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">log</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    ElMessage</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">{</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> message</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> error</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">message</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> finally</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;"> false</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">script</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span></code></pre></div></details><h3 id="引入依赖" tabindex="-1">引入依赖 <a class="header-anchor" href="#引入依赖" aria-label="Permalink to &quot;引入依赖&quot;">​</a></h3><p>实例化 <code>AppWorker</code> 后调用 <code>run</code> 方法，适用需要引入第三方依赖的场景，例如：lodash。</p><!--[--><!----><div class="el-card is-hover-shadow"><!--v-if--><div class="el-card__body" style=""><!--[--><!--[--><div><form class="el-form el-form--default el-form--label-right"><!--[--><div class="el-form-item asterisk-left" role="group" aria-labelledby="el-id-6138-3"><!--[--><!--[--><div id="el-id-6138-3" class="el-form-item__label" style="width:40px;"><!--[-->输入<!--]--></div><!--]--><!--]--><div class="el-form-item__content" style=""><!--[--><div class="el-input-number"><span role="button" aria-label="decrease number" class="el-input-number__decrease"><i class="el-icon" style=""><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"></path></svg><!--]--></i></span><span role="button" aria-label="increase number" class="el-input-number__increase"><i class="el-icon" style=""><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"></path></svg><!--]--></i></span><div class="el-input" style=""><!-- input --><!--[--><!-- prepend slot --><!--v-if--><div class="el-input__wrapper"><!-- prefix slot --><!--v-if--><input class="el-input__inner" step="1" max="Infinity" min="-Infinity" type="number" autocomplete="off" tabindex="0" style=""><!-- suffix slot --><!--v-if--></div><!-- append slot --><!--v-if--><!--]--></div></div><!--]--><!--[--><!--]--></div></div><div class="el-form-item asterisk-left" role="group" aria-labelledby="el-id-6138-4"><!--[--><!--[--><div id="el-id-6138-4" class="el-form-item__label" style="width:40px;"><!--[-->结果<!--]--></div><!--]--><!--]--><div class="el-form-item__content" style=""><!--[--><span class="el-text" style=""><!--[--><!--]--></span><!--]--><!--[--><!--]--></div></div><div class="el-form-item asterisk-left"><!--[--><!--[--><!--v-if--><!--]--><!--]--><div class="el-form-item__content" style="margin-left:40px;"><!--[--><button ariadisabled="false" type="button" class="el-button el-button--primary" style=""><!--v-if--><span class=""><!--[--> 计算斐波那契 <!--]--></span></button><!--]--><!--[--><!--]--></div></div><!--]--></form></div><!--]--><!--]--></div><!--v-if--></div><!--]--><details class="details custom-block"><summary>点击查看</summary><div class="language-vue vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">vue</span><pre class="shiki shiki-themes material-theme-lighter material-theme-darker vp-code"><code><span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">template</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">div</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">    &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> labelWidth</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">40px</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> label</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">输入</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-input-number</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> v-model</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">inputValue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-input-number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> label</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">结果</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-text</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;{{</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> result </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}}&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-text</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-button</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> type</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">primary</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> :</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> @</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">click</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">handleCalc</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">          计算斐波那契</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-button</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form-item</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">    &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">el-form</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  &lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">div</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">template</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">script</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> lang</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">ts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> setup</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> AppWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">@lib/worker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> ElMessage</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">element-plus</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> ref</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">vue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> type</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> IDepts </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">./workers/depts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> runWithDepts </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">./workers/runWithDepts?worker&amp;url</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> appWorker </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> new</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> AppWorker</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">{</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">  workerName</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">runWithDepts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">  workerPath</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> runWithDepts</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> loading </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;">false</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> inputValue </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;">50</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> result </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">=</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> ref</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;&#39;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">async</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> function</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> handleCalc</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">()</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">  try</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;"> true</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">    const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> res</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> await</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> appWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">run</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">depts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> typeof</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> IDepts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">)</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> =&gt;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">      const</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> memoize</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> depts</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">      // @see https://www.cnblogs.com/qiqi715/p/10026355.html</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">      const</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> fibonacci</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> memoize</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">):</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> number</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> =&gt;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">        if</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &lt;</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 0</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">throw</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> new</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> Error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">输入的数字不能小于0</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">        if</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ==</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ||</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ==</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 2</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">{</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">          return</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> else</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">          return</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> -</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 1</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">) </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">+</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> -</span><span style="--shiki-light:#F76D47;--shiki-dark:#F78C6C;"> 2</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">        }</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">      }</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">      return</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;"> fibonacci</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">n</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">    },</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> inputValue</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    result</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> res</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> catch</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">error</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> any</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">)</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    console</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    ElMessage</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">error</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">{</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> message</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> error</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">message</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">)</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> finally</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">    loading</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">value</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> =</span><span style="--shiki-light:#FF5370;--shiki-dark:#FF9CAC;"> false</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">  }</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;/</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">script</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span></span></code></pre></div></details><h2 id="类型定义" tabindex="-1">类型定义 <a class="header-anchor" href="#类型定义" aria-label="Permalink to &quot;类型定义&quot;">​</a></h2><details class="details custom-block"><summary>点击查看</summary><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes material-theme-lighter material-theme-darker vp-code"><code><span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> type</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> Pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> }</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">workerpool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">import</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;"> workerpool </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">from</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> &#39;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">workerpool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&#39;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">interface</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> IOptions</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * worker 文件相对路径</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">example</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> &quot;new URL(&#39;./runWithDepts.ts?worker_file&#39;, import.meta.url).href&quot;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    workerPath</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> string</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * worker 方法名称</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">description</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 与传入 `workerpool.worker({ workerName })` 参数相同</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">example</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> &quot;runWithDepts&quot;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    workerName</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> string</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">export</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> declare</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> class</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> AppWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * 最大线程数</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">description</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 与 CPU 有关</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    MAX_WORKER</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> number</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * 线程池</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> Pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> |</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> undefined</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * worker 文件路径</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    workerPath</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> string</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * worker 方法名称</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    workerName</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> string</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">    constructor</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">(</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">options</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> IOptions</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">);</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * 静态线程池</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">description</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 用来执行一些简单任务</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">    static</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> get</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">():</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> import</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">(</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#91B859;--shiki-dark:#C3E88D;">workerpool/types/Pool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&quot;</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">)</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">    /**</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * 执行方法</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">param</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> fn</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 方法函数</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">param</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> args</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 方法参数</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     * </span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">@</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">returns</span><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;"> 执行结果</span></span>
<span class="line"><span style="--shiki-light:#90A4AE;--shiki-dark:#545454;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">     */</span></span>
<span class="line"><span style="--shiki-light:#E53935;--shiki-dark:#F07178;">    run</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;">T</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> extends</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> any</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;">[]</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> R</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;(</span><span style="--shiki-light:#6182B8;--shiki-dark:#82AAFF;">fn</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> (</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">depts</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> any</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ...</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">args</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> T</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">)</span><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;"> =&gt;</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> Promise</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;">R</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> |</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> R</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> ...</span><span style="--shiki-light:#90A4AE;--shiki-dark:#EEFFFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">args</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">:</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> T</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">):</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> workerpool</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">.</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;">Promise</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&lt;</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;">any</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">,</span><span style="--shiki-light:#E2931D;--shiki-dark:#FFCB6B;"> Error</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">&gt;;</span></span>
<span class="line"><span style="--shiki-light:#9C3EDA;--shiki-dark:#C792EA;">    private</span><span style="--shiki-light:#E53935;--shiki-dark:#F07178;"> patchWorker</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">;</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;">}</span></span>
<span class="line"><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">export</span><span style="--shiki-light:#39ADB5;--shiki-dark:#89DDFF;"> {};</span></span></code></pre></div></details></div></div></main><footer class="VPDocFooter" data-v-38b48462 data-v-8c61dbc2><!--[--><!--]--><div class="edit-info" data-v-8c61dbc2><!----><div class="last-updated" data-v-8c61dbc2><p class="VPLastUpdated" data-v-8c61dbc2 data-v-01a4b550>最近更新: <time datetime="2024-01-12T09:19:52.000Z" data-v-01a4b550></time></p></div></div><nav class="prev-next" data-v-8c61dbc2><div class="pager" data-v-8c61dbc2><a class="VPLink link pager-link prev" href="/web-utils-template/pages/pdf/" data-v-8c61dbc2><!--[--><span class="desc" data-v-8c61dbc2>上一页</span><span class="title" data-v-8c61dbc2>PDF导出（A4）</span><!--]--></a></div><div class="pager" data-v-8c61dbc2><!----></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"index.md\":\"DzsUuMwG\",\"guide_installation.md\":\"CGNhLFeB\",\"pages_worker_index.md\":\"CiPTKjbc\",\"pages_pdf_index.md\":\"CAVZyg78\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Web 工具库模板\",\"description\":\"A VitePress Site\",\"base\":\"/web-utils-template/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"工具\",\"link\":\"/guide/installation\"}],\"sidebar\":[{\"text\":\"基础\",\"items\":[{\"text\":\"安装\",\"link\":\"/guide/installation\"}]},{\"text\":\"工具\",\"items\":[{\"text\":\"PDF导出（A4）\",\"link\":\"/pages/pdf/\"},{\"text\":\"Worker\",\"link\":\"/pages/worker/\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://gitee.com/jh_shot/web-utils-template\"}],\"search\":{\"provider\":\"local\",\"options\":{\"translations\":{\"button\":{\"buttonText\":\"查找\"},\"modal\":{\"noResultsText\":\"没有找到\",\"footer\":{\"navigateText\":\"导航\",\"selectText\":\"选择\",\"closeText\":\"关闭\"}}}}},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"},\"outlineTitle\":\"当前页\",\"lastUpdatedText\":\"最近更新\"},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
    
  </body>
</html>